<style type="text/css">
<!--
#imageblock {
	position:absolute;
	left:550px;
	top:290px;
	width:105px;
	height:80px;
	z-index:1;
	background-color:#CCCCCC;
}
-->
</style>
<div id="pagecontent">
 <fieldset style="border:none">
<?php 
	if($this->session->flashdata('message'))
	{
?>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="305px" height="50px" bgcolor="#FF0000"><tr><td>
<table width="300px" height="45px" bgcolor="#FFFFCC"><tr><td align="center" valign="middle">
<?php echo $this->session->flashdata('message'); ?>
</p>
</td></tr></table></td></tr></table>
</div>
<?php
	}
?>
 <div style="cursor:pointer">
<img id="vietnam" src="<?php echo base_url(); ?>images/flag_vn.gif" title="Tiếng Việt"/>&nbsp;<img id="english" src="<?php echo base_url(); ?>images/flag_uk.gif" title="English"/>
 </div>
  	<div>
		<label for="clabel_thumnail"><?php echo $this->lang->line('label_category'); ?></label>
        <select id=="article_category" name="article_category" style="width:330px">
  <?php
  		for($i=0;$i<count($article_category);$i++)
			  {
				  $selected=($article_category[$i][0]==$category_id)? "selected":"";
				  echo '<option value='.$article_category[$i][0].' '.$selected.'>'.$article_category[$i][1].'</option>';
			  }
		$small_image=($edit_article[0][2]!='')? "<img src='".base_url()."/images/article/".$edit_article[0][2]."' />":"Chưa có hình<br />đại diện";
	?>
        </select>
	</div>
 	<div>
		<label for="clabel_thumnail"><?php echo $this->lang->line('label_thumnail'); ?></label>
		<input id="clabel_thumnail" name="userfile" type="file" size="38" maxlength="50" value="" onblur="checkExt()"/> 
	</div><div align="center" id="imageblock" style="padding:3px; vertical-align:middle; color:#FF0000"><?php echo $small_image; ?></div>
	      <div style="padding-left:150px;">
		<p>Filetype: gif | jpg | jpeg</p><p>Max width: 150px, max height: 150px, max size: 100KB</p>
</div>
	<div align="left" style="height:20px; vertical-align:middle"><hr width="80%" size="1" color="#CCCCCC"/></div>
 <div id="vn">
	 <div>
		<label for="ctitle_vn"><?php echo $this->lang->line('label_title'); ?></label>
		<input id="ctitle_vn" name="title1" type="text" size="50" maxlength="100" value="<?php echo $edit_article[0][3]; ?>"/>
	</div>
	<div>
		<label for="clabel_short_desc_vn"><?php echo $this->lang->line('label_short_desc'); ?></label>
		<textarea id="clabel_short_desc_vn"  name="label_short_desc1" cols="38" rows="4"><?php echo $edit_article[0][4]; ?></textarea>
	</div>
	 <div><br />
		 <label for="cmaincontent_vn"><strong><?php echo $this->lang->line('label_content'); ?></strong></label>
		 <textarea id="cmaincontent_vn" name="maincontent1" style="width: 80%; height: 500px"><?php echo $edit_article[0][5]; ?></textarea>
	 </div>
</div>
<div id="en">
	 <div>
		<label for="ctitle"><?php echo $this->lang->line('label_title'); ?></label>
		<input id="ctitle" name="title2" type="text" size="50" maxlength="100" value="<?php echo $edit_article[1][3]; ?>" />
	</div>
	<div>
		<label for="clabel_short_desc"><?php echo $this->lang->line('label_short_desc'); ?></label>
		<textarea id="clabel_short_desc"  name="label_short_desc2" cols="38" rows="4"><?php echo $edit_article[1][4]; ?></textarea>
	</div>
	 <div><br />
		 <label for="cmaincontent"><strong><?php echo $this->lang->line('label_content'); ?></strong></label>
		 <textarea id="cmaincontent" name="maincontent2" style="width: 80%; height: 500px"><?php echo $edit_article[1][5]; ?></textarea>
	 </div>
	
</div>
		<input type="hidden" name="id" value="<?php echo $myid; ?>" />
		<input type="hidden" name="component" value="com_article" />
		<input type="hidden" name="option" value="update_article" />
		<input type="hidden" name="myurl" value="<?php echo base_url().index_page().$this->uri->uri_string(); ?>" />
		<input type="hidden" name="task" value="" />
 </fieldset>
</div>
<div align="center">
<div class="toolbar">
<table width="100px" border="0" align="center" cellpadding="5">
  <tr>
    <td align="center"><a onclick="javascript: submitbutton('save')" href="#"><span class="icon-32-save" title="<?php echo $this->lang->line('save'); ?>"> </span><?php echo $this->lang->line('save'); ?></a></td>
    <td align="center"><a onclick="javascript: submitbutton('cancel')" href="#"><span class="icon-32-cancel" title="<?php echo $this->lang->line('cancel'); ?>"> </span><?php echo $this->lang->line('cancel'); ?></a></td>
  </tr>
</table>
</div>
</div>
<script>
$('#cmaincontent').change(function() {
    var content = tinyMCE.activeEditor.getContent(); // get the content
    $('#cmaincontent').val(content); // put it in the textarea
});

function checkvalidate() 
{
	if ((document.getElementById("ctitle").value=='')  && (document.getElementById("ctitle_vn").value=='' ))
	{
		alert ("<?php echo $this->lang->line('require'); ?>");
		return 0;
	}
	return 1;
}
function checkExt()
{
	
	var filename = document.getElementById('clabel_thumnail').value;
	var filelength = parseInt(filename.length) - 3;
	var fileext = filename.substring(filelength,filelength + 3);
	if ((fileext.toLowerCase() != "gif" && fileext.toLowerCase() != "jpg" && fileext.toLowerCase() != "jpeg") || (filename==''))
	{
		alert ("Bạn chỉ có thể upload file GIF, JPG hoặc JPEG.");
		document.getElementById('clabel_thumnail').value='';
		return 0;
	}
}

</script>
